<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>枚举对象中的属性</title>
</head>
<body>
    <script>
        var obj = {
            name:"唐僧",
            age:"20",
            sex:"男",
            address:"西天"
        };
        
        //枚举对象属性：使用for(var a(变量) in 对象){}
        //执行一次输出一次
        for (var n in obj){
            console.log(n+"执行了一次，其值="+obj[n]);
        }
    </script>
</body>
</html>